<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8" />
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  <meta http-equiv="X-UA-Compatible" content="ie=edge" />
  <title>图片切换</title>
  <link rel="stylesheet" href="./css/index.css" />
</head>

<body>
  <div id="mask">
    <div class="center">
      <h2 class="title">
        <img src="./images/logo.png" alt="">
        深圳创维校区环境
      </h2>
      <!-- 图片 -->
      <img :src="src" alt="" />
      <!-- 左箭头 -->
      <a href="javascript:void(0)"  class="left" @click="prev" v-if="index>0">
          <img src="./images/prev.png" alt="" />
        </a>
      <!-- 右箭头 -->
      <a href="javascript:void(0)" class="right" @click="next" v-if="index<10">
        <img src="./images/next.png" alt="" />
      </a>
    </div>
  </div>

  <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
  <script>
    var mask=new Vue({
      el:'#mask',
      data:{
        src:'./images/00.jpg',
        index:0
      },
      methods:{
        prev(){
          this.index--
          this.src=`./images/${this.index<10?'0'+this.index:this.index}.jpg`
        },
        next(){
          this.index++
          this.src=`./images/${this.index<10?'0'+this.index:this.index}.jpg`
        }
      }
    })
  </script>

</body>

</html>
